/****************************************************************************
**                                                                         **
**                          PSSDK HNLBHosts module                         **
**            Copyright (c) 1997 - 2006 microOLAP Technologies LTD,        **
**                       Khalturin A.P., Naumov D.A.                       **
**                               Header File                               **
**                                                                         **
****************************************************************************/

//---------------------------------------------------------------------------
#ifndef __HN_PSSDK_LBHOSTS_H__
#define __HN_PSSDK_LBHOSTS_H__ 
//---------------------------------------------------------------------------

//---------------------------------------------------------------------------
// Class CHNLBHosts
//---------------------------------------------------------------------------
class CHNLBHosts
{
private:
    HANDLE hLbHst;

public:
    //###########################################################################
    //    Create & Destroy
    //###########################################################################

    //---------------------------------------------------------------------------
    // Contructor
    CHNLBHosts() { hLbHst = NULL; }

    //---------------------------------------------------------------------------
    // Destructor
    ~CHNLBHosts() { }

public:
    //###########################################################################
    //    Additionals methods
    //###########################################################################
    BOOL     IsValid() { return (BOOL)(hLbHst != NULL); }
    HANDLE   Get_Handle() { return hLbHst; }
    HANDLE   Set_Handle(HANDLE hLbHst) 
    { 
        this->hLbHst = hLbHst;
        return this->hLbHst; 
    }
    operator HANDLE() { return hLbHst; }
    HANDLE   operator =(HANDLE hLbHst) 
    {
        this->hLbHst = hLbHst;
        return this->hLbHst; 
    }

public:
    //###########################################################################
    //    Methods of redirect
    //###########################################################################

    //---------------------------------------------------------------------------
    // v2.3 - LbHstGetAddrType - Returns the address type, defined in the HNLBHosts object.
    DWORD GetAddrType() 
    { return LbHstGetAddrType(hLbHst); }

    //---------------------------------------------------------------------------
    // v2.3 - LbHstGetLocalIPv4 - Returns the IPv4 address of the local host, participating in TCP session.
    DWORD GetLocalIPv4() 
    { return LbHstGetLocalIPv4(hLbHst); }

    //---------------------------------------------------------------------------
    // v2.3 - LbHstGetRemoteIPv4 - Returns the IPv4 address of the remote host, participating in TCP session.
    DWORD GetRemoteIPv4() 
    { return LbHstGetRemoteIPv4(hLbHst); }

    //---------------------------------------------------------------------------
    // v2.3 - LbHstGetLocalPort - Returns the port number of the local host, participating in TCP session.
    WORD GetLocalPort() 
    { return LbHstGetLocalPort(hLbHst); }

    //---------------------------------------------------------------------------
    // v2.3 - LbHstGetRemotePort - Returns the port number of the remote host, participating in TCP session.
    WORD GetRemotePort() 
    { return LbHstGetRemotePort(hLbHst); }
};


//---------------------------------------------------------------------------
#endif // __HN_PSSDK_LBHOSTS_H__ 
//---------------------------------------------------------------------------
